/**
* Author: Samfu
* Time  : 下午6:48:58
* Desc  : 
*/
package com.fu.moneybag.validation;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

import com.fu.moneybag.entity.User;

public class UserSessionExpiredChecking {
	
	private Logger logger = Logger.getLogger(UserSessionExpiredChecking.class);

	//检查session是否有效
	public User userSessionCheck(HttpSession userSession) {
		
		User user = (User) userSession.getAttribute("user");
		
//		if (user == null) {
//			logger.info("User Session Expired!!");
//			try {
//				response.sendRedirect("/user/login");
//			} catch (IOException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		} else {
//			userSession.setAttribute("user", user);
//			logger.info("User session valid...");
//			
//		}
		return user;
	}
}
